﻿
namespace WT7.Web
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data;
    using System.Linq;
    using System.ServiceModel.DomainServices.EntityFramework;
    using System.ServiceModel.DomainServices.Hosting;
    using System.ServiceModel.DomainServices.Server;
    using OILDEVModel;


    // Implements application logic using the OILDEVEntities context.
    // TODO: Add your application logic to these methods or in additional methods.
    // TODO: Wire up authentication (Windows/ASP.NET Forms) and uncomment the following to disable anonymous access
    // Also consider adding roles to restrict access as appropriate.
    // [RequiresAuthentication]
    [EnableClientAccess()]
    public class DomainService1 : LinqToEntitiesDomainService<OILDEVEntities>
    {

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'WTDV_NAVIGATE_WELLs' query.
        public IQueryable<WTDV_NAVIGATE_WELL> GetWTDV_NAVIGATE_WELLs()
        {
            return this.ObjectContext.WTDV_NAVIGATE_WELLs;
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'WTDV_TAB_WELLs' query.
        public IQueryable<WTDV_TAB_WELL> GetWTDV_TAB_WELLs()
        {
            return this.ObjectContext.WTDV_TAB_WELLs;
        }

        public IQueryable<WTDV_TAB_WELL> GetWTDV_TAB_WELLs_yw(int y, int w)
        {
            return this.ObjectContext.WTDV_TAB_WELLs.Where(r => r.MONTH_PARAM.Year == y && r.ID_WELL == w);
        }

        public IQueryable<WTDV_TAB_WELL> GetWTDV_TAB_WELLs_ymw(int y, int m, int w)
        {
            return this.ObjectContext.WTDV_TAB_WELLs.Where(r => r.MONTH_PARAM.Year == y && r.MONTH_PARAM.Month == m && r.ID_WELL == w);
        }

        public IQueryable<WTDV_TAB_WELL> GetWTDV_TAB_WELLs_dw(DateTime m, int w)
        {
            return this.ObjectContext.WTDV_TAB_WELLs.Where(r => r.MONTH_PARAM == m && r.ID_WELL == w);
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'WTDV_TAB_WELL_ND_MONTH_DATAs' query.
        public IQueryable<WTDV_TAB_WELL_ND_MONTH_DATA> GetWTDV_TAB_WELL_ND_MONTH_DATAs()
        {
            return this.ObjectContext.WTDV_TAB_WELL_ND_MONTH_DATAs;
        }
        
        public IQueryable<WTDV_TAB_WELL_ND_MONTH_DATA> GetWTDV_TAB_WELL_ND_MONTH_DATAs_yw(int y, int w)
        {
            //return this.ObjectContext.WTDV_TAB_WELL_ND_MONTH_DATAs.Where(r => r.WT_MONTH.Year == y && r.ID_WELL == w);
            return this.ObjectContext.WTDV_TAB_WELL_ND_MONTH_DATAs.Include("WTDV_TAB_WELLs").Where(r => r.WT_MONTH.Year == y && r.ID_WELL == w);
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'WTDV_TAB_WELL_YEARs' query.
        public IQueryable<WTDV_TAB_WELL_YEAR> GetWTDV_TAB_WELL_YEARs()
        {
            return this.ObjectContext.WTDV_TAB_WELL_YEARs;
        }
    }
}


